<?php if(!empty($student_all_profiles)) :?>
	<div class="accord">
	  <?php foreach($student_all_profiles as $v): ?>
			
			<?php
				$profile = isset($v['profile']) && $v['profile'] ? $v['profile'] : FALSE;
				$billings = isset($v['billing']) && $v['billing'] ? $v['billing'] : FALSE;
			?>	

			<h4>SY <?php echo $profile->sy_from.' - '.$profile->sy_to; echo $profile->desc!=''?' ( '.$profile->desc.' )':''; ?></h4>

			<div>
				<?if($billings):?>
					
					<div class="table-responsive">
						
						<table class="table">
							<tbody>
								<thead>
									<td>Date Created</td>
									<td>Due Date</td>
									<td style="text-align:right;">Amount Due</td>
									<td>Status (Paid/Unpaid)</td>
									<td>Active/Inactive</td>
									<td></td>
								</thead>
								<?if($billings):?>
									<?foreach($billings as $k => $v):?>
										<tr>
											<td><?=$v['created'];?></td>
											<td><?=$v['due'];?></td>
											<td style="text-align:right;"><?=number_format($v['balance'],2,'.',',');?></td>
											<td style="text-align:center;">
												<?if($v['is_paid'] == 0):?>
													<span class="label">Unpaid</label>
												<?else:?>
													<span class="label success">Paid</label>
												<?endif;?>
											</td>
											<td style="text-align:center;">
												<?if($v['is_active'] == 0):?>
													<span class="label">In active</label>
												<?else:?>
													<span class="label success">Active</label>
												<?endif;?>
											</td>
											<td>
												<?$s_link = __link(intval($id),intval($v['id']))?>
												<div class="btn-group">
												
												<a href="<?=site_url('pdf/billing_form_print/'.$s_link);?>" class="confirm btn btn-mini" target="_blank" title="Continue to Print?"><i class="icon-print"></i></a>
												
												</div>
											</td>
										</tr>
									<?endforeach;?>
								<?else:?>
									<tr class="info">
										<td  colspan="6">No Billing Form Found for this student.</td>
									</tr>
								<?endif;?>
							<tbody>
					</table>

					</div>

				<?else:?>
					<div class="alert alert-warning">No billing yet.</div>
				<?endif;?>
			</div>

		<?php endforeach; ?>
	</div>
<?php endif; ?>
